import { geSysCfgInfo } from "@/utils/http.js"
import baseconfig from '@/config.js'
export default {
	namespaced: true,
	state: {
		inviteCode: '',
		custm: {}
	},
	getters: {},
	mutations: {
		setInviteCode(state, code) {
			state.inviteCode = code
		},
		setSysSetting(state, setting) {
			if (setting["danbaoimg1"]) {
				setting["danbaoimg1"] = baseconfig.api_url + setting["danbaoimg1"]
				setting["danbaoimg2"] = baseconfig.api_url + setting["danbaoimg2"]
			}
			if (setting["userdefimg"]) {
				setting["userdefimg"] = baseconfig.api_url + setting["userdefimg"]
			}
			state.custm = setting
		}
	},
	actions: {
		reloadSysSetting({ commit }) {
			geSysCfgInfo().then(res => {
				const { data } = res
				commit('setSysSetting', data)
			})
		}

	}
}